package com.inspectortime.authorizenet;

import com.inspectortime.webapp.payment.AuthorizeNetPaymentRequestHelper;
import com.inspectortime.webapp.payment.PaymentUtils;

public class PaymentRequestTesterApp {

	public static void main(String[] args) {
		
    	// Uses Inspector Time, Inc's payment ids
    	//String loginID			= "4LaSp6R8Z";
    	//String transactionKey	= "4rRNxy27zFP65V8y";
		
		// edifice
		// login 28MF2ub23
		// txnKey 2d5xVhdAU2322x27
		
		// Timestamp problems, see this: http://developer.authorize.net/tools/responsecode97/
		String[] invoiceUniqueFields = PaymentUtils.generateInvoiceNumber();
		int timestamp = Integer.parseInt(invoiceUniqueFields[0]);
		int sequenceNumber = Integer.parseInt(invoiceUniqueFields[1]);
		String invoiceNumber = invoiceUniqueFields[2];
		
		AuthorizeNetPaymentRequestHelper paymentReqest = new AuthorizeNetPaymentRequestHelper("28MF2ub23", "2d5xVhdAU2322x27");
		paymentReqest.setTimestamp(timestamp);
		paymentReqest.setSequenceNumber(sequenceNumber);
		paymentReqest.setInvoiceNumber(invoiceNumber);
		paymentReqest.execute();
		System.out.println(paymentReqest.getExecutionLog());
	}
}
